package com.mzy.multithreading.basic;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/7/28 7:29
 * @Version 1.0
 */
public class DaemonThread {
    public static void main(String[] args) {
        Thread bb = new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "::" + Thread.currentThread().isDaemon());
            for (; ; ) {

            }
        }, "BB");
        // 将当前用户线程设置为守护线程
        // !! 注意设置守护线程，要在线程启动之前才能生效
        bb.setDaemon(true);
        bb.start();
        System.out.println(Thread.currentThread().getName()+ " over结束");

    }
}
